<?php
namespace app\admin\controller;
use think\Db;
use think\Request;
use app\common\controller\order\Orderget;
class Orderyuqi extends Common
{
	
	//	后台代扣页面  相当于部分还款
	public function daikou(){
		$ID= input();//订单ID
		$data=Db::table('xb_loans_applylist')->where('ID',$ID['ID'])->find();//
		$Orderget = new Orderget();
		$data['daoqiMoney']=$Orderget->get_muqian_yinghuan_money($data); // 目前应还
		$this->assign('data',$data);
		return $this->fetch();
	}
//	设置催收人员操作
	public function cuishou_people(){
		$this->logs('添加催收客服');
        $data=input();
		$idarr=json_decode($data['idarr'],1);
		$where['ID']=array('in',$idarr);
		$re=Db::table('xb_loans_applylist')->where($where)->update(['cuishourenID'=> $data['cuishouren'],'cuishourenTime' => date('Y-m-d H:i:s',time())]);//用户ID
	    if($re){
		   show_success();
		}else{
		   show_error();
		}
	}
//	设置催收人员页面
	public function couishou_people_add(){
        $data=Db::table('xb_sys_administrator')->where(['RoleID'=>'54'])->select();//用户ID
        $this->assign('data',$data);
        return $this->fetch();
	}
	//催收备注添加页面
	public function beizhu(){
		$ID=input('ID');
		$this->assign('ID',$ID);
	    return $this->fetch();
	}
	//催收备注添加操作
	public function beizhu_caozuo(){
		$this->logs('催收员添加备注');
		$data=input();
		$data['Create_time']=date('Y-m-d H:i:s');//时间
		$data['adminID']=session('id');
		$re=Db::table('xb_beizhu')->insertGetId($data);
		if($re){
		   show_success();
		}else{
		   show_error();
		}
	}
	//   逾期页面
    public function yuqi()
    {
		$qudao=$this->qudao();//调用渠道数据
		$this->assign('qudao',$qudao);
		$loanStatus = ['已放款', '已完成'];
		$this->assign('loanStatus',$loanStatus);
		$Orderget=new Orderget();
		$RoleID=$Orderget->get_RoleID();
		$this->assign('RoleID',$RoleID);
		return $this->fetch();	
    }
}
